import {uuid} from '@/utils/utils'
import {SpanWidth} from './Enums';


//组件公共属性
const commonOptions = (name:string)=>{
  return {
    title:'default title', 
    id: name + '-' + uuid(),
    name,
    showTitle:true,
    inline:false,
    check:{
      required:false
    },
    span:SpanWidth.W1,
    fieldPermissions:{
      show:true,
      edit:true
    },
    field: '', // 字段名称
    value:'',
    describe:'',
    subFormCompSpan:'1/1',
    subFormCompWidth:160,
  }
}


//组件自有属性
const compDataTemp =()=>{
  
  return {

    'radio':{
      ...commonOptions('radio'),
      title:'单选按钮组', 
      props:{
        options:[
          {label:'选项1',value:'值1',id:uuid()},
          {label:'选项2',value:'值2',id:uuid()},
          {label:'选项3',value:'值3',id:uuid()},
        ],
        vertical:true, //竖向排列 默认 true
      }
    },

    'input':{
      ...commonOptions('input'),
      title:'文本组件', 

      props:{
        textarea:false,
        tip:'',
        format:'',
        defaultValType:'customize',
      }
      
    },

    'splitLine':{
      ...commonOptions('splitLine'),
      title:'分割线', 
      showTitle:false,

      tit:'分割线',
      showTit:true,
      splitDesc:'',
      styles: {
        titColor:'#333',
        lineColor:'#666',
        dashed:false
      }
    },
    
    'placeBlock':{
      ...commonOptions('placeBlock'),
      title:'', 
      showTitle:false,
    },

    'select':{
      ...commonOptions('select'),
      title:'下拉选择器', 

      props:{
        tip:'',
        options:[
          {label:'选项1',value:'值1',id:uuid()},
          {label:'选项2',value:'值2',id:uuid()},
          {label:'选项3',value:'值3',id:uuid()}
        ],
        multiple:false
      }
      
    },
    
    'datePicker':{
      ...commonOptions('datePicker'),
      title:'日期选择器', 

      props:{
        allowClear:'',
        picker: 'default',
        showTime: false,
        showToday: true,
        swDefaultValue: false,
        defaultValue:''
      }
      
    },

    'dateRange':{
      ...commonOptions('dateRange'),
      title:'日期范围选择', 

      props:{
        allowClear:'',
        maxDate: "",
        minDate: "",
        picker: 'default',
        showTime: true,
        swDefaultValue: false,
        defaultValue:''
      }
      
    },

    'checkbox':{
      ...commonOptions('checkbox'),
      title:'复选框组', 

      props:{
        options:[
          { label: '选项1', value: '值1', check: false },
          { label: '选项2', value: '值2', check: false },
        ],
        direction:"vertical"
      }
      
    },

    'upload':{
      ...commonOptions('upload'),
      title:'附件', 

      props:{
        action: "",
        delete: "",
        // drag: false,
        listType: "",
        maxCount: "",
        multiple: false,
        search: ""
      }
      

      
    },

    'staffTree':{
      ...commonOptions('staffTree'),
      title:'人员选择', 
      
      multiple:false
    },

    'orgTree':{
      ...commonOptions('orgTree'),
      title:'组织架构选择', 
      
      multiple:false
    },

    'subForm':{
      ...commonOptions('subForm'),
      title:'子表单', 
      children:[ [] ],
      stickyColumn:{enable:false,limit:0}
    },

  }
}
export default compDataTemp;